﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <LinearGradientBrush x:Key="ToggleButtonBrush">
        <GradientStop Color="Gray" Offset="0" />
        <GradientStop Color="#222222" Offset=".7" />
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="ToggleButtonMouseOverBrush">
        <GradientStop Color="Silver" Offset="0" />
        <GradientStop Color="#333333" Offset=".7" />
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="ToggleButtonCheckedBrush">
        <GradientStop Color="#333333" Offset="0" />
        <GradientStop Color="Red" Offset=".7" />
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="ToggleButtonPressedBrush">
        <GradientStop Color="#333333" Offset="0" />
        <GradientStop Color="Gray" Offset=".7" />
    </LinearGradientBrush>

    <ControlTemplate x:Key="ToggleButtonTemplate" TargetType="{x:Type ToggleButton}">
        <Grid>
            <Border x:Name="Border" BorderThickness="1" CornerRadius="2" BorderBrush="Black">
                <Label x:Name="Content" Padding="0" Margin="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Foreground="White" VerticalContentAlignment="Center" HorizontalContentAlignment="Center">
                    <ContentPresenter />
                </Label>
            </Border>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="False">
                <Setter TargetName="Content" Property="Background" Value="{StaticResource ToggleButtonBrush}"/>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter TargetName="Content" Property="Background" Value="{StaticResource ToggleButtonMouseOverBrush}"/>
                <Setter TargetName="Border" Property="BorderBrush" Value="Gray" />
            </Trigger>
            <Trigger Property="IsChecked" Value="True">
                <Setter TargetName="Content" Property="Background" Value="{StaticResource ToggleButtonCheckedBrush}"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter TargetName="Border" Property="BorderBrush" Value="Gold" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style TargetType="{x:Type ToggleButton}">
        <Setter Property="Control.Template" Value="{StaticResource ToggleButtonTemplate}"/>
    </Style>

</ResourceDictionary>  